"""vis_sys URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.conf.urls import url
from django.urls import path
from tmp_news import views
from echart import views as e_views
from django.contrib.staticfiles.urls import staticfiles_urlpatterns, static
from django.views.decorators.cache import cache_page

urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'^news_index$', views.NewsIndexView.as_view(), name='news_index'),
    url(r'^$', views.home_page, name='home_page'),
    url(r'^news_api$', views.get_news_list, name='get_news_list'),
    url(r'^news/(?P<p_id>\d+)/$', views.news_dashboard, name='news_dashboard'),
    url(r'^get_news/(?P<p_id>\d+)/$', views.get_dashboard, name='get_dashboard'),
    url(r'^news_china/(?P<p_id>\d+)/$', views.get_china_dashboard, name='get_china_dashboard'),
    url(r'^vote_index$', views.VoteIndexView.as_view(), name='vote_index'),
    url(r'^get_vote/(?P<p_id>\d+)/$', views.vote_detail, name='get_vote'),
    url(r'^get_map/(?P<p_id>\d+)/$', views.get_map, name='get_map'),
    url(r'^vote_page/(?P<p_id>\d+)/$', views.vote_page, name='vote_page'),
    url(r'^add_count/(?P<p_id>\d+)/$', views.add_count, name='add_count'),
    url(r'^xinhuanews$', cache_page(60*60)(views.get_xinhuanews), name='xinhuanews'),
    url(r'^xinhuanews_page$', cache_page(60*60)(views.xinhuanews_page), name='xinhuanews_page'),
    url(r'^xinhuanews_all$', views.get_xinhuanews_all, name='xinhuanews_all'),
    url(r'^xinhua_picnews$', views.get_xinhua_picnews, name='xinhua_picnews'),

    url(r'^login$', e_views.LoginView, name='login'),
    url(r'^logout$', e_views.LogoutView, name='logout'),
]


urlpatterns += [
    url(r'^chart_index', e_views.ChartIndexView.as_view(), name='chart_index'),
    url(r'^get_chart/(?P<p_id>\d+)/$', e_views.get_chart, name='get_chart'),
    url(r'^chart/(?P<p_id>\d+)/$', e_views.chart_page, name='chart'),
    url(r'^load_data', e_views.load_data, name='load_data'),
    url(r'^baidu_range', e_views.get_baidu_range, name='baidu_range'),
    url(r'^baidu_zone_range', e_views.get_baidu_zone_range, name='baidu_zone_range'),
    url(r'^baidu$', e_views.baidu_page, name='baidu'),
    url(r'^baidu_zone_page', e_views.baidu_zone_page, name='baidu_zone_page'),
    url(r'^fsp_media_focus', cache_page(60*15)(e_views.fanwen_media_focus), name='fw_media_focus'),
    url(r'^fsp_toutiao', cache_page(60*15)(e_views.fanwen_toutiao), name='fw_toutiao'),
    url(r'^fsp_use_hot', cache_page(60*15)(e_views.fanwen_use_hot), name='fw_use_hot'),
    url(r'^fsp_statistics', cache_page(60*60)(e_views.fanwen_statistic), name='fw_statistics'),
    url(r'^fsp_fsnews', cache_page(60*60)(e_views.fanwen_fs_news), name='fw_fsnews'),
    url(r'^fsp_newsbm', cache_page(60*60*12)(e_views.fanwen_newsBM), name='fw_newsbm'),

    url(r'^fsp_diffusion_detail',cache_page(60*60)(e_views.fanwen_fs_diffusion), name='fw_fs_diffusion'),

    url(r'^ts_boxoffice', cache_page(60*60*2)(e_views.get_boxoffice), name='realtime_boxoffice'),
    url(r'^ts_contry_info', cache_page(60*60*2)(e_views.get_contry_info), name="contry_info"),
    # 天气
    url(r'^ts_weather', cache_page(60*60*2)(e_views.weather_api), name="weather_api"),
    # 高明假数据
    url(r'^map_news', e_views.map_news, name="map_news"),
    url(r'^tour_api', cache_page(60*60*12)(e_views.tour_fake_api), name="tour"),

    url(r'^emotion_chart', cache_page(60*60*2)(e_views.emotion_chart), name="emotion"),

    url(r'^leader$', cache_page(60*60*6)(e_views.get_leaderids), name="get_leaders"),
    url(r'^leader_keyword', cache_page(60*60*6)(e_views.get_leader_news_keyword), name="leader_keyword"),
    url(r'^leader_news', cache_page(60*60*6)(e_views.get_leader_news), name="leader_news"),
    url(r'^leader_detail', cache_page(60*60*6)(e_views.get_detail_news), name="leader_detail"),
    url(r'^leader_static', cache_page(60*60*6)(e_views.leader_static), name="leader_static"),

    url(r'^advanced_search', cache_page(60*15)(e_views.advanced_search_actical), name="advanced_search"),
    url(r'^search_page', e_views.search_page, name="search_page"),

    url(r'^emotion_page', e_views.foshan_emotions_page, name="emotion_page"),
    url(r'^foshan_news', cache_page(60*15)(e_views.foshan_emotions_news), name="foshan_news"),

    url(r'^fsrb_distribution', cache_page(60*15)(e_views.fsrb_distribution), name="fsrb_distribution"),

    # API
    url(r'^hot_word', cache_page(60*60*12)(e_views.foshan_hot_word), name="hot_word"),
    url(r'^fsnews_api', cache_page(60*5)(e_views.fsnews_api), name="fsnews_api"),
    url(r'^fw_city', cache_page(60*60*12)(e_views.get_city_by_code), name="fs_city"),

    # 专题
    url(r'^get_fw_event_list', e_views.get_fw_event_list, name="fw_events"),
    url(r'^event_detail', e_views.event_detail, name="event_detail"),

    # Elasticsearch API
    url(r'^get_local_news', e_views.local_news, name="local_news"),
    url(r'^article_source', e_views.article_source, name="article_source"),
    url(r'^articles_per_day', e_views.article_static_days, name="article_days"),
    url(r'^article_static_days_and_source', e_views.article_static_days_and_source, name="article_static_ds"),
    url(r'^get_emotion_static', e_views.get_emotion_static, name="get_emotion_static"),
    url(r'^get_media_static', e_views.get_media_static, name="get_media_static"),
    url(r'^get_similar_article', e_views.get_similar_article, name="get_similar_article"),
    url(r'^get_emotion_by_zone', e_views.get_emotion_by_zone, name="get_emotion_by_zone"),
    url(r'^get_zone_static', e_views.get_zone_static, name="get_zone_static"),
    # app
    url(r'^get_app_hot_word', e_views.app_hotword, name="get_app_hot_word"),

    # 机器学习
    # url(r'^predict_class', e_views.news_class_predict, name="predict_class"),
    url(r'^news_analyse', e_views.news_analyse, name="news_analyse"),
    url(r'^comment_analyse', e_views.comment_analyse, name="comment_analyse"),
    url(r'^class_image', e_views.cv_api, name="class_image"),
]

urlpatterns += staticfiles_urlpatterns()